#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QResizeEvent>
#include <d2d1.h>
#include <d2d1_1.h>
#include <d2d1helper.h>

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();
protected:
    void paintEvent(QPaintEvent *event);
    void resizeEvent(QResizeEvent* e);
    QPaintEngine* paintEngine() const;
private:
    HRESULT CreateDeviceResources();
    void DiscardDeviceResources();
    ID2D1Factory1* d2d1_factory_ = nullptr;
    ID2D1HwndRenderTarget* render_target_ = nullptr;
    ID2D1SolidColorBrush* brush_ = nullptr;
};
#endif // WIDGET_H
